import 'package:built_collection/built_collection.dart';
import 'package:equatable/equatable.dart';
import 'package:backend.core/core/domain/entities/api/web/api_web_purchased_item.dart';
import 'package:backend.core/core/domain/entities/api/web/api_web_purchased_subscription_status.dart';
import 'package:backend.core/core/domain/entities/api/web/api_web_purchased_subscription_transaction.dart';

class ApiWebPurchasedSubscription extends Equatable implements ApiWebPurchasedItem {
  const ApiWebPurchasedSubscription({
    required this.originalTransactionId,
    required this.purchaseItemSku,
    required this.autoRenewalEnabled,
    required this.status,
    required this.expirationTime,
    required this.transactions,
    required this.test,
  });

  @override
  final String purchaseItemSku;

  @override
  final bool test;

  final String originalTransactionId;
  final bool autoRenewalEnabled;
  final ApiWebPurchasedSubscriptionStatus status;
  final DateTime? expirationTime;
  final BuiltList<ApiWebPurchasedSubscriptionTransaction> transactions;

  @override
  List<Object?> get props {
    return [
      originalTransactionId,
      purchaseItemSku,
      autoRenewalEnabled,
      status,
      expirationTime,
      transactions,
      test,
    ];
  }
}
